package com.hqyj.base.service.impl;

import com.hqyj.base.mapper.InfoGoodsMapper;
import com.hqyj.base.model.InfoGoods;
import com.hqyj.base.service.InfoGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ProjectName: ERP-System
 * @Package: com.hqyj.base.service.impl
 * @ClassName: InfoGoodsServiceImpl
 * @Author: LiYi
 * @Date: 2021-09-08 9:10
 */

@Service
public class InfoGoodsServiceImpl implements InfoGoodsService {
    @Autowired
    private InfoGoodsMapper infoGoodsMapper;

    @Override
    public List<InfoGoods> queryAllByInfoGoods() {
        return infoGoodsMapper.queryAllByInfoGoods();
    }

    @Override
    public int addInfoGoods(InfoGoods infoGoods) {
        return infoGoodsMapper.insert(infoGoods);
    }

    @Override
    public int deleteInfoProductsById(int urlId) {
        return infoGoodsMapper.deleteByPrimaryKey(urlId);
    }

    @Override
    public InfoGoods queryInfoGoodsById(int urlId) {
        return infoGoodsMapper.queryInfoGoodsById(urlId);
    }

    @Override
    public int updateInfoGoodsById(InfoGoods infoGoods) {
        return infoGoodsMapper.updateByPrimaryKeySelective(infoGoods);
    }

    @Override
    public List<InfoGoods> queryFuzzyInfoGoods(String keyword) {
        return infoGoodsMapper.queryFuzzyInfoGoods(keyword);
    }

    @Override
    public InfoGoods queryAllByTradeName(String tradeName) {
        InfoGoods infoGoods = infoGoodsMapper.queryAllByGoodsName(tradeName);
        return infoGoods;
    }
}
